import logging,yamail,HTMLTestRunner_cn
import os.path
import time

class Tools():
    def log2(self):
        log2 = logging.basicConfig(level=logging.DEBUG,
                                   format='%(levelname)s %(message)s %(asctime)s %(filename)s %(lineno)d',
                                   filename=r'E:\gg4\PythonProject1\po_126mail\log\yyy.log',
                                   filemode='a+')
        return log2

    def report(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(open(r'E:\gg4\PythonProject1\po_126mail\report\yyy.html','wb'),
                                               title = 'yyy登录业务测试报告',
                                               description ='yyy，测试结果，生成测试报告')
        return report

    def Email(self):
        email = yamail.SMTP(user='3080172040@qq.com',password='ceswygiwtqzcdfhd',host='smtp.qq.com',port=465)
        email.send(to='3080172040@qq.com',subject='yyy试结果',contents=['执行了5条测试用例，进通过',
                                                                           r'E:\gg4\PythonProject1\po_126mail\log\yyy.log',
                                                                           r'E:\gg4\PythonProject1\po_126mail\report\yyy.html'])
        email.close()


